package com.wannengbang.cloudleader.homepage;

import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.gyf.immersionbar.ImmersionBar;
import com.wannengbang.cloudleader.R;
import com.wannengbang.cloudleader.base.BaseActivity;
import com.wannengbang.cloudleader.base.DataCallBack;
import com.wannengbang.cloudleader.bean.QuotaCountBean;
import com.wannengbang.cloudleader.bean.QuotaListBean;
import com.wannengbang.cloudleader.homepage.model.HomePageModelImpl;
import com.wannengbang.cloudleader.homepage.model.IHomePageModel;
import com.wannengbang.cloudleader.widget.AppTitleBar;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class TeamQuotaActivity extends BaseActivity {

    @BindView(R.id.title_bar)
    AppTitleBar titleBar;
    @BindView(R.id.tv_total_num)
    TextView tvTotalNum;
    @BindView(R.id.ll_jiju_bg)
    LinearLayout llJijuBg;
    @BindView(R.id.ll_look1)
    LinearLayout llLook1;
    @BindView(R.id.ll_look2)
    LinearLayout llLook2;
    private IHomePageModel homePageModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_team_quota);
        ButterKnife.bind(this);
        ImmersionBar.with(this)
                .statusBarDarkFont(false)
                .navigationBarDarkIcon(true)
                .navigationBarColor(R.color.white)
                .statusBarDarkFont(false, 0.2f)
                .init();
        homePageModel = new HomePageModelImpl();
    }

    @Override
    protected void onResume() {
        super.onResume();
        requestMyQuotaCount();
    }

    public void requestMyQuotaCount() {
        homePageModel.requestMyQuotaCount(new DataCallBack<QuotaCountBean>() {
            @Override
            public void onSuccessful(QuotaCountBean bean) {
                int totalNum = bean.getData().getFulfil() + bean.getData().getNotFulfilNotExpired() + bean.getData().getNotFulfilExpired();
                tvTotalNum.setText(totalNum + "");
            }

            @Override
            public void onFailed(String msg, String code) {

            }
        });
    }

    @OnClick({R.id.ll_look1, R.id.ll_look2, R.id.ll_look3})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_look1:
                showActivity(TeamBuyListActivity.class);
                break;
            case R.id.ll_look2:
                showActivity(MyTeamQuotaActivity.class);
                break;
            case R.id.ll_look3:
                showActivity(SettlementRecordsActivity.class);
                break;
        }
    }
}
